™Macintosh Toolbox EssentialsContentsFigures, Tables, and Listings
About This BookFormat of a Typical ChapterConventions Used in This Book
Special FontsTypes of Notes
Empty StringsAssembly-Language InformationThe Development Environment%Introduction to the Macintosh ToolboxKFigure 1-1 The SurfWriter application with multiple windows on the desktop !Overview of the Macintosh ToolboxEvents
MenusWindowsFigure 1-2 A typical windowControlsFigure 1-3 Common controlsAlert Boxes and Dialog BoxesFigure 1-4 An alert box:Figure 1-5 Modal, movable modal, and modeless dialog boxes,Icons and Other Interactions With the Finder
Resources
Help BalloonsCopy and Paste Related System Software FeaturesDrawing on the Screen
Handling TextManaging Files)Allocating Memory and Launching Processes#Creating Publishers and Subscribers&
Communicating With Other ApplicationsDesigning Your Application
Event ManagerIntroduction to Events5Figure 2-1 Sources of events sent to your application
High-level eventsPriority of EventsSwitching ContextsAbout the Event ManagerUsing the Event Manager"Obtaining Information About Events3Figure 2-5 The modifiers field of the event record Processing Events Using the WaitNextEvent Function,Listing 2-1 Using the WaitNextEvent functionWriting an Event LoopListing 2-2 An event loopListing 2-3
Processing events Setting the Event MaskFigure 2-6 The event maskHandling Events in a Dialog BoxCreating a Size Resource7Listing 2-4 The Rez input for a sample 'SIZE' resource Handling Low-Level EventsResponding to Mouse Events&Listing 2-5 Handling mouse-down eventsResponding to Keyboard EventsDFigure 2-7 The message field of the event record for keyboard events Figure 2-8
Keyboard translationCFigure 2-9 Virtual key codes for the Apple Keyboard II, ISO layout CFigure 2-10
Virtual key codes for the Apple Extended Keyboard II 1Listing 2-6 Handling key-down and auto-key events$Listing 2-7 Handling key-down eventsScanning for a Cancel Event/Listing 2-8 Scanning for a Command-period eventResponding to Update Events7Figure 2-11
Responding to an update event for a window'Listing 2-9 Responding to update eventsResponding to Activate Events7Figure 2-12
Responding to activate events for a window*Listing 2-10 Responding to activate events"Responding to Disk-Inserted Events/Listing 2-11 Responding to disk-inserted eventsResponding to Null Events!Listing 2-12 Handling null events Handling Operating-System Events2Listing 2-13 Responding to operating-system events'Responding to Suspend and Resume Events4Listing 2-14 Responding to suspend and resume events Responding to Mouse-Moved Events%Figure 2-13 The standard arrow cursorEFigure 2-14 The I-beam, crosshairs, plus sign, and wristwatch cursors2Figure 2-15 The arrow region and the I-beam regionKFigure 2-16
Changing the cursor from the I-beam cursor to the arrow cursor Listing 2-15 Changing the cursorHandling High-Level Events ,Responding to Events From Other Applications*Listing 2-16 Accepting a high-level event )Searching for a Specific High-Level Event,Determining the Sender of a High-Level EventSending High-Level Events@Listing 2-17 Posting a high-level event by application signatureGListing 2-18
Using the PPCBrowser function to post a high-level event Requesting Return ReceiptsHandling Apple EventsEvent Manager Reference
Data StructuresThe Event RecordThe Target ID Record#The High-Level Event Message RecordThe Event Queue
PPostEvent PostEvent0Converting Process Serial Numbers and Port Names#
GetProcessSerialNumberFromPortName#
GetPortNameFromProcessSerialNumber
Reading the MouseGetMouseButton
StillDownWaitMouseUp
Reading the KeyboardGetKeysKeyTranslate9Figure 2-17 Structure of the KeyTranslate function result
Getting Timing Information TickCount
GetDblTimeGetCaretTime
Application-Defined Routine8Filter Function for Searching the High-Level Event QueueMyFilterResourceThe Size Resource1Listing 2-19 A Rez template for a 'SIZE' resource
Summary of the Event ManagerMenu ManagerIntroduction to Menus9Figure 3-1 A pull-down menu, a submenu, and a pop-up menuMFigure 3-2 The SurfWriter application’s menu bar with the Edit menu displayed%Menu and Menu Bar Definition RoutinesThe Menu Bar5Figure 3-3 The menu bar of the SurfWriter applicationUFigure 3-4 The SurfWriter application’s menu bar localized for another script system
Menus
Menu Items1Figure 3-5 Two menus with various characteristicsGroups of Menu Items4Figure 3-6
Menu items in a mutually exclusive group.Figure 3-7 Menu items in an accumulating group?Figure 3-8 Use of a checkmark and dash in an accumulating group&Keyboard Equivalents for Menu Commands8Table 3-1 Reserved keyboard equivalents for all systems >Table 3-2
Reserved keyboard equivalents for worldwide systems,Table 3-3 Other common keyboard equivalents -Menus Added Automatically by the Menu ManagerThe Apple Menu9Figure 3-9
The Apple menu for the SurfWriter applicationEFigure 3-10 Choosing the About command of the SurfWriter application
The File Menu5Figure 3-11 The standard File menu for an application1Table 3-4 Actions for standard File menu commands
The Edit Menu5Figure 3-12 The standard Edit menu for an application1Table 3-5 Actions for standard Edit menu commands
The Font Menu Figure 3-13 A typical Font menu IFigure 3-14 A Font menu showing a selection containing more than one font
The Size MenuFigure 3-15 A typical Size menu>Figure 3-16 A dialog box to select a new point size for a font1Figure 3-17
Entering a new point size for a font:Figure 3-18 The Other command with a font size added to it
The Help Menu7Figure 3-19 The Help menu of the SurfWriter applicationJFigure 3-20
Default help balloons for the Apple menu and Application menuAFigure 3-21 Help balloons for different states of the Cut command
The Keyboard Menu;Figure 3-22 Accessing the Keyboard menu from an applicationThe Application Menu)Figure 3-23 SurfWriter’s Application menuPop-Up MenusFigure 3-24 A pop-up menu8Figure 3-25 A pop-up menu in its closed and open states 1Figure 3-26 Making a selection from a pop-up menu6Figure 3-27 Choosing one attribute from a list of many:Figure 3-28
A dialog box with checkboxes and pop-up menus?Figure 3-29 A type-in pop-up menu in its closed and open states=Figure 3-30
A type-in pop-up menu with a user’s choice addedHierarchical Menus5Figure 3-31
A hierarchical menu item and its submenuAbout the Menu Manager7
How the Menu Manager Maintains Information About MenusJHow the Menu Manager Maintains Information About an Application’s Menu BarUsing the Menu ManagerCreating a MenuCreating a Menu Resource?Listing 3-1 Rez input for a 'MENU' resource for the Apple menu {Table 3-6
Specifying submenus, script codes, reduced icons, small icons, and color icons of a menu item in a menu resource<Listing 3-2 Rez input for a 'MENU' resource for an Edit menu;Listing 3-3 Rez input for a 'MENU' resource for a File menuCreating a Menu Bar Resource,Listing 3-4 Rez input for an 'MBAR' resource&Setting Up Your Application’s Menu Bar:Listing 3-5 Setting up an application’s menus and menu bar7Listing 3-6 Saving and restoring menu color information
Creating a Hierarchical Menu&Figure 3-32 A menu item with a submenuNListing 3-7 Rez input for a description of a hierarchical menu with a submenu(Listing 3-8 Creating a hierarchical menuCreating a Pop-Up Menu)Figure 3-33 A pop-up menu in a dialog box*Changing the Appearance of Items in a Menu"
Enabling and Disabling Menu ItemsChanging the Text of an Item,Listing 3-9 Changing the text of a menu item%Changing the Font Style of Menu Items1Listing 3-10 Setting the font style of menu items
Changing the Mark of Menu Items?Listing 3-11 Adding marks to and removing marks from menu items.Changing the Icon or Script Code of Menu Items Figure 3-34
Icons in menu items,Listing 3-12 Specifying icons for menu itemsAdding Items to a Menu.Listing 3-13
Rez input for text of menu itemsAdding Items to the Help Menu-Listing 3-14
Adding an item to the Help menuAdding Items to the Apple Menu0Listing 3-15 Adding menu items to the Apple menuAdding Fonts to a Menu)Listing 3-16
Adding font names to a menu&Handling User Choice of a Menu Command+
Handling Mouse-Down Events in the Menu Bar<Listing 3-17 Determining whether a mouse-down event occurred<Listing 3-18 Determining when the cursor is in the menu bar %Adjusting the Menus of an Application.Listing 3-19
Adjusting an application’s menus:Listing 3-20 Adjusting the File menu for a document window:Listing 3-21 Adjusting the Edit menu for a document window3Determining if the User Chose a Keyboard Equivalent.Listing 3-22 Determining when a key is pressed@Listing 3-23 Checking a key-down event for a keyboard equivalent,Responding When the User Chooses a Menu Item>Listing 3-24 Responding to the user’s choice of a menu commandHandling the Apple MenuKListing 3-25 Responding to the user’s choice of an item from the Apple menuHandling the Help MenuLListing 3-26 Responding to the user’s choice of a command from the Help menuHandling a Size Menu7Figure 3-35
A Size menu with user-specified size added#Listing 3-27 Handling the Size menu!Accessing Menus From a Dialog Box/Figure 3-36 Menu access from a modal dialog box*Writing Your Own Menu Definition Procedure/Listing 3-28 A sample menu definition procedure$Calculating the Dimensions of a Menu+Listing 3-29 Calculating the size of a menu
Drawing Menu Items in a MenuListing 3-30 Drawing menu items9Determining Whether the Cursor Is in an Enabled Menu Item Listing 3-31 Choosing menu itemsMenu Manager ReferenceData StructuresThe Menu Record
The Menu List'The Menu Color Information Table Record,Table 3-7 Color information for menu entriesMenu Manager RoutinesITable 3-8 Mapping between new and previous names of Menu Manager routines
Initializing the Menu Manager InitMenusInitProcMenu
Creating MenusNewMenuGetMenu=Adding Menus to and Removing Menus From the Current Menu List
InsertMenu
DeleteMenuClearMenuBar6Getting a Menu Bar Description From an 'MBAR' Resource
GetNewMBar Getting and Setting the Menu Bar
GetMenuBar
SetMenuBar
GetMBarHeightDrawing the Menu BarDrawMenuBar
InvalMenuBar1Responding to the User’s Choice of a Menu Command
MenuSelectMenuKey
MenuChoice
HiliteMenuPopUpMenuSelect
SystemMenu
SystemEdit!Getting a Handle to a Menu Record
GetMenuHandleHMGetHelpMenuHandleAdding and Deleting Menu Items
AppendMenu
InsertMenuItemDeleteMenuItem
AppendResMenu
InsertResMenu0Getting and Setting the Appearance of Menu Items
EnableItemDisableItemGetMenuItemText
SetMenuItemTextGetItemStyleSetItemStyle
GetItemMarkSetItemMark CheckItem
GetItemIconSetItemIcon
GetItemCmd
SetItemCmdDisposing of MenusDisposeMenuCounting the Items in a Menu
CountMItemsHighlighting the Menu BarFlashMenuBarSetMenuFlashRecalculating Menu Dimensions
CalcMenuSize4Managing Entries in the Menu Color Information Table GetMCInfo SetMCInfo
DisposeMCInfo
GetMCEntrySetMCEntriesDeleteMCEntries
Application-Defined RoutineThe Menu Definition Procedure MyMenuDef ResourcesThe Menu Resource:Figure 3-37 Structure of a compiled menu ('MENU') resourcesFigure 3-38 The variable-length data that describes menu items as defined by the standard menu definition procedure
The Menu Bar Resource>Figure 3-39 Structure of a compiled menu bar ('MBAR') resource)The Menu Color Information Table ResourceRFigure 3-40 Structure of a compiled menu color information table ('mctb') resourceBFigure 3-41
Structure of a menu color entry in an 'mctb' resource&The Menu Definition Procedure Resource
Summary of the Menu ManagerWindow ManagerIntroduction to WindowsFigure 4-1 Multiple windowsFigure 4-2 A document windowActive and Inactive Windows0Figure 4-3
Active and inactive document windows
Types of Windows'Figure 4-4 A window of type zoomDocProcPFigure 4-5
A window of type zoomDocProc, with size box and inactive scroll barsMFigure 4-6 Window types for alert boxes and fixed-position modal dialog boxes,Figure 4-7
A window of type movableDBoxProc)Figure 4-8 A window of type noGrowDocProc$Figure 4-9
Seldom-used window types
Window Regions>Figure 4-10 Window frame, content region, and structure regionDialog Boxes and Alert BoxesControlsFigure 4-11 Scroll bars$Figure 4-12 Controls in a dialog boxWindows on the DesktopAbout the Window ManagerGraphics Ports1Figure 4-13 The QuickDraw global coordinate plane;Figure 4-14
A window’s local and global coordinate systemsWindow Records
Color WindowsEvents in WindowsUsing the Window ManagerManaging Multiple Windows(Listing 4-1
Determining the window typeCreating a WindowDefining a Window ResourceJListing 4-2 Rez input for a window ('WIND') resource for a document window!Creating a Window From a Resource!Listing 4-3 Creating a new window,Positioning a Document Window on the Desktop9Figure 4-15
Document window positions on a single screen:Figure 4-16 “Filling in” an empty document window position:Figure 4-17
Document window positions on multiple screensPListing 4-4 Application-defined data structure for storing a window’s state data/Listing 4-5 Saving a document window’s positionHListing 4-6
Positioning the window when the user opens a saved document$Listing 4-7 Opening a saved document
Drawing the Window ContentsListing 4-8 Drawing a windowUpdating the Content RegionJFigure 4-18 Moving one window and adding to another window’s update regionMaintaining the Update RegionHandling Events in Windows Handling Mouse Events in Windows&Listing 4-9 Handling mouse-down events7Figure 4-19 The close box with and without highlighting7Figure 4-20
The zoom box with and without highlighting#Handling Keyboard Events in Windows
Handling Update Events^Figure 4-21
The effects of BeginUpdate and EndUpdate on the visible region and
update region#Listing 4-10 Handling update eventsHandling Activate Events%Listing 4-11 Handling activate eventsMoving a WindowZooming a WindowListing 4-12
Zooming a windowResizing a WindowListing 4-13 Resizing a windowLListing 4-14 Adjusting scroll bars and content region when resizing a window<Listing 4-15 Converting a window region to local coordinatesClosing a Window%Listing 4-16 Handling a close commandListing 4-17 Closing a documentHiding and Showing a WindowNFigure 4-22 The cumulative effects of HideWindow, ShowWindow, and SelectWindow(Listing 4-18 Showing a hidden dialog boxWindow Manager ReferenceData StructuresThe Color Window Record
The Window Record
The Window State Data RecordThe Window Color Table RecordThe Auxiliary Window RecordThe Window List Window Manager RoutinesInitializing the Window ManagerInitWindowsCreating Windows
ZoomWindow Closing and Deallocating WindowsTrackGoAwayCloseWindow
DisposeWindowMaintaining the Update RegionBeginUpdate EndUpdate InvalRectInvalRgn ValidRectValidRgn3Setting and Retrieving Other Window Characteristics
SetWindowPicGetWindowPic
SetWRefCon
GetWRefCon
GetWVariantManipulating the DesktopSetDeskCPat
GetGrayRgnGetCWMgrPortGetWMgrPort%Manipulating Window Color InformationSetWinColor GetAuxWinLow-Level RoutinesCheckUpdate ClipAboveSaveOldDrawNew
PaintOnePaintBehindCalcVis
CalcVisBehind
Application-Defined RoutineThe Window Definition FunctionMyWindow ResourcesThe Window Resource<Figure 4-24 Structure of a compiled window ('WIND') resource'The Window Definition Function ResourceThe Window Color Table ResourceIFigure 4-25
Structure of a compiled window color table ('wctb') resourceSummary of the Window ManagerControl ManagerIntroduction to Controls<Figure 5-1 Standard controls provided by the Control ManagerButtonsFigure 5-2 A default button
CheckboxesFigure 5-3 A selected checkbox
Radio ButtonsPop-Up MenusScroll Bars Figure 5-4 A vertical scroll bar1Figure 5-5 Using the scroll box and scroll arrowshFigure 5-6
Spatial relations between a document and a window, and their representation by
a scroll bar
Other Controls!Figure 5-7 Custom slider controlsActive and Inactive ControlsAFigure 5-8
Visual feedback for user selection of active controlsFigure 5-9 Inactive controls
The Control Definition FunctionAbout the Control ManagerUsing the Control Manager!Creating and Displaying a Control,Creating a Button, Checkbox, or Radio Button'Figure 5-10 A button in a simple window*Listing 5-1 Creating a button for a window,Listing 5-2 Rez input for a control resource,Figure 5-11 Radio buttons in a simple windowAListing 5-3
Rez input for the control resources of radio buttonsCreating Scroll Bars<Figure 5-12 How a scroll bar should overlap the window frameDListing 5-4 Rez input for resources for a window and its scroll bars7Listing 5-5 Creating a document window with scroll barsCreating a Pop-Up MenuFigure 5-13
A pop-up menu?Listing 5-6 Rez input for the control resource of a pop-up menu.Figure 5-14 Dimensions of a sample pop-up menuUpdating a Control6Listing 5-7 Responding to an update event for a window7Listing 5-8 Redrawing the controls in the update region'Responding to Mouse Events in a Control+Determining a Mouse-Down Event in a Control3Listing 5-9 Detecting mouse-down events in a windowFListing 5-10 Detecting mouse-down events in a pop-up menu and a button&Figure 5-15 Three controls in a window Tracking the Cursor in a Control;Listing 5-11
Using the TrackControl function with a button3Listing 5-12
Using TrackControl with a pop-up menu)Determining and Changing Control Settings0Listing 5-13 Responding to a click in a checkbox9Listing 5-14 Adjusting scroll bar settings and locations .Listing 5-15 Assigning settings to scroll barsHListing 5-16 Adjusting the maximum and current settings for a scroll barScrolling Through a Document5Figure 5-16
Moving a document relative to its windowIListing 5-17
Using ScrollRect to scroll the bits displayed in the window6Figure 5-17 Updating the contents of a scrolled window0Figure 5-18 Restoring the window origin to (0,0)/Figure 5-19
Scrolling to the end of a documentQFigure 5-20 Updating a window’s contents and returning the window origin to (0,0)1Scrolling in Response to Events in the Scroll Box7Listing 5-18 Responding to mouse events in a scroll bar?Scrolling in Response to Events in Scroll Arrows and Gray AreasEListing 5-19
Action procedures for scrolling through a text document=Listing 5-20 Moving the scroll box from the action procedures,
Drawing a Scrolled Document Inside a Window2Listing 5-21 An application-defined update routine;Listing 5-22 Redrawing a window containing graphics objectsGListing 5-23
Redrawing a window after scrolling a TextEdit edit recordMoving and Resizing Scroll Bars,Figure 5-21 Moving and resizing scroll bars EListing 5-24 Changing the size and location of a window’s scroll barsZFigure 5-22
A vertical scroll bar before the application moves it within a resized windowRFigure 5-23 A vertical scroll bar after the application moves its upper-left point.
Defining Your Own Control Definition FunctionFigure 5-24 A custom controlControl Manager ReferenceData StructuresThe Control Record
The Auxiliary Control Record#The Pop-Up Menu Private Data RecordThe Control Color Table RecordControl Manager RoutinesLTable 5-1 Mapping between new and previous names of Control Manager routines
Creating Controls
GetNewControl
NewControlDrawing Controls
ShowControlUpdateControlsDrawControlsDraw1Control!Handling Mouse Events in Controls
FindControlTrackControl
TestControl%Changing Control Settings and DisplaySetControlValueSetControlMinimumSetControlMaximumSetControlTitle
HideControlMoveControlSizeControl
HiliteControlDragControl
SetControlColor
SetControlActionDetermining Control ValuesGetControlValueGetControlMinimumGetControlMaximumGetControlTitleGetControlReferenceSetControlReferenceGetControlActionGetControlVariantGetAuxiliaryControlRecord
Removing ControlsDisposeControlKillControlsApplication-Defined Routines-Defining Your Own Control Definition Function MyControl#Defining Your Own Action ProceduresMyActionMyIndicatorAction Resources
The Control Resource=Figure 5-25 Structure of a compiled control ('CNTL') resource The Control Color Table ResourceJFigure 5-26
Structure of a compiled control color table ('cctb') resourceThe Control Definition Function
Summary of the Control ManagerDialog Manager'Introduction to Alerts and Dialog Boxes*Figure 6-1 An alert box used by the FinderFigure 6-2 A typical dialog boxTypes of AlertsFigure 6-3 A note alertFigure 6-4 A caution alertFigure 6-5 A stop alertTypes of Dialog Boxes
Modal Dialog BoxesFigure 6-6 A modal dialog boxMovable Modal Dialog Boxes%Figure 6-7 A movable modal dialog boxModeless Dialog Boxes Figure 6-8 A modeless dialog box
Items in Alert and Dialog Boxes(Figure 6-9 Typical items in a dialog box Events in Alert and Dialog Boxes1Alert Boxes, Dialog Boxes, and the Window ManagerAbout the Dialog ManagerUsing the Dialog Manager%Creating Alert Sounds and Alert Boxes6Figure 6-10 An alert box to save changes to a document+Listing 6-1 Rez input for an alert resourcePFigure 6-11 An alert box displayed only during the third and fourth alert stagesIListing 6-2 Specifying different alert responses according to alert stage8Listing 6-3 Creating your own sound procedure for alertsCreating Dialog Boxes&Figure 6-12
A simple modal dialog box+Listing 6-4 Rez input for a dialog resource*Providing Items for Alert and Dialog Boxes>Figure 6-13
Relationship of various resources to an alert box;Listing 6-5 Rez input for providing an alert box with items
Item Types1Figure 6-14 A safe default button in an alert box
Display RectanglesGFigure 6-15
The consistent spacing of buttons and text in an alert boxCListing 6-6
Rez input for consistent spacing of display rectangles\Figure 6-16
Incorrectly and correctly sized display rectangles for alternate script systems
Enabled and Disabled ItemsResource IDs for Items1Figure 6-17
Inactive controls and disabled items1Titles for Buttons, Checkboxes, and Radio Buttons3Figure 6-18 A dialog box with OK and Cancel buttons9Figure 6-19 A movable modal dialog box with a Stop button-Figure 6-20 An alert box with a Revert button5
Text Strings for Static Text and Editable Text Items0Figure 6-21 An obscure and useless alert message(Figure 6-22 A less obscure alert message-Figure 6-23 A clear and helpful alert message
Pop-Up Menus as Items)Figure 6-24 A pop-up menu in a dialog boxrListing 6-7 Rez input for a dialog resource and an item list resource for a dialog box that includes a pop-up menuRListing 6-8 Rez input for a control resource and a menu resource for a pop-up menuKeyboard Navigation Among ItemsManipulating Items&Figure 6-25
A selected scrolling listChanging Static Text6Figure 6-26 An alert box that displays a document nameEListing 6-9
Using the ParamText procedure to substitute text stringsVListing 6-10 Specifying where ParamText should substitute text in an alert box message%Getting Text From Editable Text Items<Figure 6-27 Two editable text items in a modeless dialog box;Listing 6-11 Specifying editable text items in an item listJListing 6-12 Getting the text entered by the user in an editable text item&Adding Items to an Existing Dialog Box6Figure 6-28 An existing dialog box and items to append3Figure 6-29 The dialog box after items are overlaid@Figure 6-30 The dialog box after items are appended to the rightBFigure 6-31
The dialog box after items are appended to the bottomKFigure 6-32 A dialog box with an item appended relative to an existing item9Listing 6-13
Appending an item to an existing dialog boxCListing 6-14 Rez input for a dialog box and the item appended to itPUsing an Application-Defined Item to Draw the Bold Outline
for a Default ButtonGListing 6-15
Rez input for an application-defined item in an item listJListing 6-16 Installing the draw procedure for an application-defined itemZListing 6-17 Creating a draw procedure that draws a bold outline around the default button!Displaying Alert and Dialog Boxes"Positioning Alert and Dialog Boxes7Figure 6-33
An alert box in front of a document window+Figure 6-34 An alert box on the main screenLFigure 6-35 An alert box in the alert position of the document window screen8Deactivating Windows Behind Alert and Modal Dialog BoxesIListing 6-18 Deactivating the front window before displaying an alert boxCFigure 6-36 An alert box displayed only after the third alert stageQListing 6-19 Using GetAlertStage to determine when to deactivate the front window Displaying Modeless Dialog BoxesAFigure 6-37 A modeless dialog box for changing text in a documentYListing 6-20
Ensuring that the modeless dialog box isn’t already open before creating it'
Adjusting Menus for Modal Dialog Boxes:Figure 6-38 Menu access when displaying a modal dialog box1Listing 6-21
Adjusting menus for various windowsLListing 6-22 Disabling menus for a modal dialog box with editable text items<Listing 6-23
Adjusting the Edit menu for a modal dialog box;Adjusting Menus for Movable Modal and Modeless Dialog Boxes+
Displaying Multiple Alert and Dialog Boxes5Displaying Alert and Dialog Boxes From the Background.Including Color in Your Alert and Dialog BoxesZListing 6-24 Rez input for a dialog color table resource using the system’s default colors*
Handling Events in Alert and Dialog Boxes Responding to Events in Controls,
Responding to Events in Editable Text Items2Listing 6-25 Using DialogSelect during null events$
Responding to Events in Alert Boxes?Figure 6-39 Three buttons for which CautionAlert reports events*Responding to Events in Modal Dialog Boxes;Figure 6-40 Four items for which ModalDialog reports events7Listing 6-26 Responding to events in a modal dialog boxAWriting an Event Filter Function for Alert and Modal Dialog BoxesMListing 6-27 A typical event filter function for alert and modal dialog boxesFResponding to Mouse Events in Modeless and
Movable Modal Dialog BoxesHFigure 6-41
A modeless dialog box for which DialogSelect reports events7Listing 6-28 Handling mouse-down events for all windowsPListing 6-29 Using the DialogSelect function for responding to mouse-down eventsHListing 6-30 Hiding a modeless dialog box in response to a Close commandIResponding to Keyboard Events in Modeless and
Movable Modal Dialog BoxesCListing 6-31 Checking for key-down events involving the Command keyBListing 6-32 Checking for key-down events in a modeless dialog boxCListing 6-33 Responding to key-down events in a modeless dialog boxSResponding to Activate and Update Events in Modeless and Movable Modal Dialog Boxes-Listing 6-34 Activating a modeless dialog box+Listing 6-35 Updating a modeless dialog boxClosing Dialog BoxesDialog Manager ReferenceData StructureThe Dialog RecordDialog Manager RoutinesKTable 6-1 Mapping between new and previous names of Dialog Manager routines
Initializing the Dialog ManagerInitDialogs
ErrorSound
SetDialogFontCreating AlertsAlert
StopAlert
NoteAlert
CautionAlert
GetAlertStageResetAlertStage'
Creating and Disposing of Dialog BoxesGetNewDialogNewColorDialog NewDialogCloseDialog
DisposeDialog,Manipulating Items in Alert and Dialog Boxes
GetDialogItem
SetDialogItemHideDialogItemShowDialogItem
FindDialogItem
AppendDITLShortenDITL CountDITL(
Handling Text in Alert and Dialog Boxes ParamTextGetDialogItemTextSetDialogItemTextSelectDialogItemText DialogCut
The Dialog Resource<Figure 6-42 Structure of a compiled dialog ('DLOG') resource
The Alert Resource;Figure 6-43 Structure of a compiled alert ('ALRT') resourceThe Item List Resource?Figure 6-44 Structure of a compiled item list ('DITL') resourcehFigure 6-45
Structure of compiled button, checkbox, radio button, static text, and editable
text itemsBFigure 6-46 Structure of compiled control, icon, and picture items=Figure 6-47
Structure of a compiled application-defined item,Figure 6-48 Structure of compiled help itemsThe Dialog Color Table ResourceThe Alert Color Table ResourceThe Item Color Table Resource=Figure 6-49 Structure of a compiled item color table resource7Figure 6-50 Structure of a compiled control color table4Figure 6-51 Structure of a compiled text style table
Summary of the Dialog ManagerFinder Interface$Introduction to the Finder InterfaceEFigure 7-1
Application and document icons in a window on the desktop=Figure 7-2
A customized help balloon for an application icon=Figure 7-3 A Finder message identifying a missing application
About the Finder InterfaceUsing the Finder InterfaceWGiving a Signature to Your Application and a Creator and a
File Type to Your Documents.Listing 7-1 Rez input for a signature resource
Creating Icons for the FinderOFigure 7-4 Large black-and-white application icons for a company’s product line.Figure 7-5 Default large black-and-white iconsAFigure 7-6 A black-and-white icon and its mask for an application&Figure 7-7 The ResEdit view of an icon/Listing 7-2 Rez input for an icon list resource"Creating Customized Document Icons!Creating File Reference Resources3Listing 7-3
Rez input for file reference resourcesCreating a Bundle Resource+Listing 7-4 Rez input for a bundle resourceXFigure 7-8 Linking icon list resources and file reference resources in a bundle resource1How and When the Finder Launches Your ApplicationA
Displaying Messages When the Finder Can’t Find
Your Application8Figure 7-9 The default application-unavailable alert boxEListing 7-5
Rez input for a missing-application name string resourcebListing 7-6 Storing a missing-application name string resource in the resource fork of
a documentfListing 7-7 Copying the missing-application name string resource into the resource fork of
a documentRFigure 7-10 The application-unavailable alert box specifying an application’s nameHListing 7-8 Rez input for an application-missing message string resourceKFigure 7-11 The application-unavailable alert box with a customized messageQFigure 7-12 The application-unavailable alert box for 'TEXT' and 'PICT' documents
Providing Version Resources5Listing 7-9 Rez input for a pair of version resources,Using Finder Information in the Catalog File7Figure 7-13
The version data in the information windowSupporting Stationery Pads*Listing 7-10 Rez input for a size resource@Listing 7-11
Determining whether a document is a stationery pad7Distributing Fonts, Sounds, and Other Movable Resources,Providing Balloon Help for Nondocument IconsFFigure 7-14 Default and customized help balloons for application iconsKListing 7-12
Rez input for a help balloon resource for an application icon
Using Aliases?Listing 7-13 Using the ResolveAliasFile function to open a file3Using the System Folder and Its Related Directories1Figure 7-15 The System Folder and related foldersThe Desktop DatabaseFinder Interface ReferenceData Structures
File Information Record Extended File Information Record
Directory Information Record%Extended Directory Information RecordRoutinesResolving Alias Files
ResolveAliasFileFinding Directories
FindFolder Resources
The Signature ResourceTFigure 7-16 Structure of a signature resource compiled as a string ('STR ') resourceThe Icon List Resource?Figure 7-17 Structure of a compiled icon list ('ICN#') resourceThe Small Icon List ResourceEFigure 7-18 Structure of a compiled small icon list ('ics#') resource#The Large 4-Bit Color Icon ResourceLFigure 7-19 Structure of a compiled large 4-bit color icon ('icl4') resource#The Small 4-Bit Color Icon ResourceLFigure 7-20 Structure of a compiled small 4-bit color icon ('ics4') resource#The Large 8-Bit Color Icon ResourceLFigure 7-21 Structure of a compiled large 8-bit color icon ('icl8') resource#The Small 8-Bit Color Icon ResourceMFigure 7-22
Structure of a compiled small 8-bit color icon ('ics8') resourceThe Icon Resource;Figure 7-23
Structure of a compiled icon ('ICON') resourceThe Color Icon ResourceThe File Reference ResourceDFigure 7-24 Structure of a compiled file reference ('FREF') resourceThe Bundle Resource=Figure 7-25
Structure of a compiled bundle ('BNDL') resourceMFigure 7-26
Mapping local IDs to icon list resource IDs in a bundle resourcehFigure 7-27 Structure of superfluous local ID mapping for file reference resources in a
bundle resource$The Missing-Application Name String LFigure 7-28 Structure of a compiled missing-application name string resource'The Application-Missing Message String OFigure 7-29 Structure of a compiled application-missing message string resourceThe Version Resource;Figure 7-30